﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ZebraCoreLib;
using ZebraCoreLib.Notice;
using ZebraCoreLib.Stock;

namespace ZebraCoreLibTester
{
    /// <summary>
    /// Summary description for UnitTest1
    /// </summary>
    [TestClass]
    public class NoticeTest
    {
        public NoticeTest()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test 
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        //[TestMethod]
        public void NoticeAdd()
        {
            Notice notice = new Notice(){ ID="123", OpTime=DateTime.Now, PONO="pono123123", seCode="kicalchend1sd23f456", sgArea="LAX", suCode="ITS00002", Vendor="vendor", seExpress="USPS"};
            NoticeDetails details1 = new NoticeDetails() { GoodsName = "asdasda", Qty = 12, SKU = "123213232123" };
            NoticeDetails details2 = new NoticeDetails() { GoodsName = "asdaasdadsda", Qty = 14, SKU = "1232232213123" };
            notice.NoticeDetails = new List<NoticeDetails>();
            notice.NoticeDetails.Add(details1);
            notice.NoticeDetails.Add(details2);

            notice.Add(notice);
           
        }

        [TestMethod]
        public void NoticeList()
        {
            Notice notice = new Notice();

            int pageSize=0;
            var list = notice.List("sucode='its00002'", ListFlags.Details, 1,1,out pageSize);
             
            var notice1 = list[0];
            notice1.seExpress = "ASD";
            notice1.seCode = "IVAN1890DIEJF209486";
               
            //notice1.Update(notice1); 
        }

        //[TestMethod]


        //[TestMethod]
        public void StockList()
        {
            GoodsStock stock = new GoodsStock();
             int pageSize = 0;
            var list = stock.List("sucode='its00002'", ListFlags.Details, 1, 5, out pageSize);

          

            //notice1.Update(notice1); 
        }
    }
}
